#include <iostream>
#include<functional>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>


int main()
{
    pid_t id=fork();
    if(id==0)
    {
        sleep(200);
        // int a=1;
        // a/=0;
        int*p=nullptr;
        *p=10;
        exit(1);
    }

    int status;
    pid_t rid=waitpid(id,&status,0);
    if(rid>0)
    {
        printf("exit code:%d, exit signal:%d, code dump:%d\n",
                (status>>8)&0xFF,status&0x7F,(status>>7)&1);
    }
    return 0;
}
